﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
using WcfGeebaServer;
using WcfGeebaServer.Policies;
using WcfGeebaServer.ContentManage;
using WcfGeebaServer.Users;

namespace WcfGeebaServer
{
    [ServiceContract]
    public interface IAppService
    {
        // GForum methods
        [OperationContract]
        bool init(string admin, string adminPass, GPolicy policy);

        [OperationContract]
        User entry();

        [OperationContract]
        bool register(string username, string pass);

        [OperationContract]
        Member login(User oldUser, string username, string pass);

        [OperationContract]
        User logout(string memberUsername);

        [OperationContract]
        List<GSubForum> getSubForums();

        [OperationContract]
        List<GThread> getThreads(GSubForum subforum);

        [OperationContract]
        bool addSubForum(Member requesting, string topic, string memberUsername);

        [OperationContract]
        bool removeSubForum(Member requesting, string topic);

        [OperationContract]
        int getMemberThreadCount(Member requesting, string memberUsername);

        [OperationContract]
        bool changePassword(Member requesting, string oldPass, string newPass);

        [OperationContract]
        int getConnectedMembersCount();

        [OperationContract]
        bool SetActiveMember(Member requesting, bool active);

        [OperationContract]
        bool BanMember(Member requesting, string usernameToBan);

        // GSubForum methods
        [OperationContract]
        int publish(Member requesting, string topic, GThread message);

        [OperationContract]
        bool removeThread(Member requesting, string topic, int threadId);

        [OperationContract]
        List<Member> getModerators(Member requesting, string topic);

        [OperationContract]
        bool addModerator(Member requesting, string topic, string memberUsername);

        [OperationContract]
        bool replaceModerator(Member requesting, string topic, string oldMemberUsername, string newMemberUsername);

        [OperationContract]
        bool removeModerator(Member requesting, string topic, string memberUsername);

        [OperationContract]
        int getThreadCount(Member requesting, string topic);

        [OperationContract]
        List<GThread> searchByContent(string content);

        [OperationContract]
        List<GThread> searchByUser(string username);

        // Gthread methods
        [OperationContract]
        int comment(Member requesting, GPost message, string topic, int threadId);

        [OperationContract]
        List<GPost> getComments(string topic, int threadId);

        [OperationContract]
        bool editContent(Member requesting, string topic, int parentThreadId, string newContent);

        [OperationContract]
        bool bumpThread(Member requesting, string topic, int parentThreadId);

        [OperationContract]
        bool replaceAdmin(Member requesting, string newAdmin);
    }
}